package netty.tcp;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;

public class ClientHandler extends ChannelOutboundHandlerAdapter {


    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        //读取数据
//        ByteBuf buf = (ByteBuf) msg;
//        byte[] req = new byte[buf.readableBytes()];
//        buf.readBytes(req);
//        String body = null;
//        try {
//            body = new String(req, "UTF-8");
//            Arrays.stream(body.split(",")).forEach(time -> {
//                if (!"".equals(time)) {
//                    timeDelay.analyze(Long.parseLong(time));
//                }
//            });
//        } catch (UnsupportedEncodingException e) {
//            e.printStackTrace();
//        } finally {
//            buf.release();
//        }
        ctx.write(msg);
//        super.write(ctx, msg, promise);
    }


}
